SuppliedTextWidget

class SuppliedTextWidget(messageSupplier: Supplier<Text>, textRenderer: TextRenderer, width: Int, height: Int) : AbstractTextWidget, TooltipChild

An AbstractTextWidget that renders text from a supplier of text, not a static text instance

Author

fzzyhmstrs

Since

0.3.1, removed align:direction: methods and now implements TooltipChild in 0.6.0

Parameters

messageSupplier

Supplier<Text> - supplies text to this widget

textRenderer

TextRenderer - textRenderer instance

width

Int - width of the widget in pixels

height

Int - height of the widget in pixels

Constructors

Link copied to clipboard
constructor(messageSupplier: Supplier<Text>, textRenderer: TextRenderer)
constructor(messageSupplier: Supplier<Text>, textRenderer: TextRenderer, width: Int, height: Int)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var message: Text
Link copied to clipboard
Link copied to clipboard
protected var textColor: Int
Link copied to clipboard
Link copied to clipboard
var x: Int
Link copied to clipboard
var y: Int

Functions

Link copied to clipboard
fun align(horizontalAlignment: Float): SuppliedTextWidget

Aligns the widget text to the alignment fraction provided

Link copied to clipboard
override fun appendNarrations(builder: NarrationMessageBuilder)
Link copied to clipboard
open fun charTyped(chr: Char, modifiers: Int): Boolean
Link copied to clipboard
open override fun forEachChild(consumer: Consumer<ClickableWidget>)
Link copied to clipboard
open fun getBottom(): Int
Link copied to clipboard
@Nullable
open fun getFocusedPath(): GuiNavigationPath?
Link copied to clipboard
open override fun getHeight(): Int
Link copied to clipboard
open override fun getNavigationFocus(): ScreenRect
Link copied to clipboard
@Nullable
open override fun getNavigationPath(navigation: GuiNavigation): GuiNavigationPath?
Link copied to clipboard
open fun getRight(): Int
Link copied to clipboard
@Nullable
open fun getTooltip(): Tooltip?
Link copied to clipboard
open override fun getType(): Selectable.SelectionType
Link copied to clipboard
open override fun getWidth(): Int
Link copied to clipboard
open fun isHovered(): Boolean
Link copied to clipboard
open override fun isMouseOver(mouseX: Double, mouseY: Double): Boolean
Link copied to clipboard
open override fun isNarratable(): Boolean
Link copied to clipboard
open fun isSelected(): Boolean
Link copied to clipboard
open fun keyPressed(keyCode: Int, scanCode: Int, modifiers: Int): Boolean
Link copied to clipboard
open fun keyReleased(keyCode: Int, scanCode: Int, modifiers: Int): Boolean
Link copied to clipboard
open override fun mouseClicked(mouseX: Double, mouseY: Double, button: Int): Boolean
Link copied to clipboard
open override fun mouseDragged(mouseX: Double, mouseY: Double, button: Int, deltaX: Double, deltaY: Double): Boolean
Link copied to clipboard
open fun mouseMoved(mouseX: Double, mouseY: Double)
Link copied to clipboard
open override fun mouseReleased(mouseX: Double, mouseY: Double, button: Int): Boolean
Link copied to clipboard
open fun mouseScrolled(mouseX: Double, mouseY: Double, horizontalAmount: Double, verticalAmount: Double): Boolean
Link copied to clipboard
open fun onClick(mouseX: Double, mouseY: Double)
Link copied to clipboard
open fun onRelease(mouseX: Double, mouseY: Double)
Link copied to clipboard
open fun playDownSound(soundManager: SoundManager)
Link copied to clipboard
open fun provideNarrationLines(): List<Text>

Provides a list of text for appending into a Narration Hint. By default this will use the same lines passed from provideTooltipLines, with predefined values for the inputs

Link copied to clipboard
open override fun provideTooltipLines(mouseX: Int, mouseY: Int, parentSelected: Boolean, keyboardFocused: Boolean): List<Text>

Provides a list of text lines for appending to a tooltip. Unlike appending in MC, the parent has final say on compiling the tooltip from the pieces given to it.

Link copied to clipboard
override fun render(context: DrawContext, mouseX: Int, mouseY: Int, delta: Float)
Link copied to clipboard
open fun setAlpha(alpha: Float)
Link copied to clipboard
open fun setDimensions(width: Int, height: Int)
Link copied to clipboard
open fun setDimensionsAndPosition(width: Int, height: Int, x: Int, y: Int)
Link copied to clipboard
open fun setHeight(height: Int)
Link copied to clipboard
open fun setPosition(x: Int, y: Int)
Link copied to clipboard
open fun setTooltip(@Nullable tooltip: Tooltip?)
Link copied to clipboard
open fun setTooltipDelay(tooltipDelay: Duration)
Link copied to clipboard
open fun setWidth(width: Int)
Link copied to clipboard
fun supplyTooltipOnOverflow(tooltipText: Supplier<Text>): SuppliedTextWidget

supplies a text for tooltips if the text overflows the width of the widget.